Tarea 1: Resultados Experimentales

CC4102: Diseño y Análisis de Algoritmos

Integrantes :

Cuerpo Docente:

Importación de librerías importante

# Manipulación de estructuras
library(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.0 --
## v ggplot2 3.3.3     v purrr   0.3.4
## v tibble  3.1.0     v dplyr   1.0.5
## v tidyr   1.1.3     v stringr 1.4.0
## v readr   1.4.0     v forcats 0.5.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(dplyr)
library(tidyr)

# Para realizar plots
#library(scatterplot3d)
library(ggplot2)
# library(plotly)

Experimento Aleatorio

random.abb = read.table("Resultados/aleatorioAbb.txt")
random.avl = read.table("Resultados/aleatorioAvl.txt")
random.splay = read.table("Resultados/aleatorioSplay.txt")
random.btree16 = read.table("Resultados/aleatorioBtree16.txt")
random.btree256 = read.table("Resultados/aleatorioBtree256.txt")
random.btree4096 = read.table("Resultados/aleatorioBtree4096.txt")
Experimento_aleatorio <-  data.frame(Operacion = integer(),
                                     V1 = double(),
                                     Estructura = factor()) 

z <- data.frame(Operacion = c(1:1000), V1 = random.abb, Estructura = "ABB")
Experimento_aleatorio <- rbind(Experimento_aleatorio, z)

z <- data.frame(Operacion = c(1:1000), V1 = random.avl, Estructura = "AVL")
Experimento_aleatorio <- rbind(Experimento_aleatorio, z)

z <- data.frame(Operacion = c(1:1000), V1 = random.splay, Estructura = "Splay")
Experimento_aleatorio <- rbind(Experimento_aleatorio, z)

z <- data.frame(Operacion = c(1:1000), V1 = random.btree16, Estructura = "BTree16")
Experimento_aleatorio <- rbind(Experimento_aleatorio, z)

z <- data.frame(Operacion = c(1:1000), V1 = random.btree256, Estructura = "BTree256")
Experimento_aleatorio <- rbind(Experimento_aleatorio, z)

z <- data.frame(Operacion = c(1:1000), V1 = random.btree4096, Estructura = "BTree4096")
Experimento_aleatorio <- rbind(Experimento_aleatorio, z)

Estadísticas relevantes

summary(Experimento_aleatorio)
##    Operacion            V1             Estructura       
##  Min.   :   1.0   Min.   :0.0001490   Length:6000       
##  1st Qu.: 250.8   1st Qu.:0.0005940   Class :character  
##  Median : 500.5   Median :0.0009835   Mode  :character  
##  Mean   : 500.5   Mean   :0.0017397                     
##  3rd Qu.: 750.2   3rd Qu.:0.0017060                     
##  Max.   :1000.0   Max.   :0.0115030
plot <- ggplot(data = Experimento_aleatorio, aes(x=Estructura, y=V1, color=Estructura)) + 
  geom_boxplot() +
  xlab("Estructuras") +  
  ylab("Tiempo [s]") + 
  ggtitle("Boxplot por cada estructura\nExperimento aleatorio") + 
  theme(plot.title = element_text(hjust = 0.5))
plot

Gráfico de Tiempos

plot <- ggplot(data = Experimento_aleatorio, aes(x=Operacion, y=V1), inherit.aes = FALSE) + 
  geom_line(aes(colour=Estructura)) +
  xlab("Promedios de cada segmento de iteraciones") +  
  ylab("Tiempo [s]") + 
  ggtitle("Tiempo por cada segmento de operaciones\nExperimento aleatorio") + 
  theme(plot.title = element_text(hjust = 0.5))
plot

Experimento Creciente 0.1

creciente01.abb = read.table("Resultados/creciente0p1Abb.txt")
creciente01.avl = read.table("Resultados/creciente0p1Avl.txt")
creciente01.splay = read.table("Resultados/creciente0p1Splay.txt")
creciente01.btree16 = read.table("Resultados/creciente0p1Btree16.txt")
creciente01.btree256 = read.table("Resultados/creciente0p1Btree256.txt")
creciente01.btree4096 = read.table("Resultados/creciente0p1Btree4096.txt")
Experimento_creciente0p1 <-  data.frame(Operacion = integer(),
                                     V1 = double(),
                                     Estructura = factor()) 

z <- data.frame(Operacion = c(1:1000), V1 = creciente01.avl, Estructura = "AVL")
Experimento_creciente0p1 <- rbind(Experimento_creciente0p1, z)

z <- data.frame(Operacion = c(1:1000), V1 = creciente01.splay, Estructura = "Splay")
Experimento_creciente0p1 <- rbind(Experimento_creciente0p1, z)

z <- data.frame(Operacion = c(1:1000), V1 = creciente01.btree16, Estructura = "BTree16")
Experimento_creciente0p1 <- rbind(Experimento_creciente0p1, z)

z <- data.frame(Operacion = c(1:1000), V1 = creciente01.btree256, Estructura = "BTree256")
Experimento_creciente0p1 <- rbind(Experimento_creciente0p1, z)

z <- data.frame(Operacion = c(1:1000), V1 = creciente01.btree4096, Estructura = "BTree4096")
Experimento_creciente0p1 <- rbind(Experimento_creciente0p1, z)

Estadísticas relevantes

summary(Experimento_creciente0p1)
##    Operacion            V1            Estructura       
##  Min.   :   1.0   Min.   :0.000126   Length:5000       
##  1st Qu.: 250.8   1st Qu.:0.000516   Class :character  
##  Median : 500.5   Median :0.000705   Mode  :character  
##  Mean   : 500.5   Mean   :0.001734                     
##  3rd Qu.: 750.2   3rd Qu.:0.001517                     
##  Max.   :1000.0   Max.   :0.010293
plot <- ggplot(data = Experimento_creciente0p1, aes(x=Estructura, y=V1, color=Estructura)) + 
  geom_boxplot() +
  xlab("Estructuras") +  
  ylab("Tiempo [s]") + 
  ggtitle("Boxplot por cada estructura, sin ABB\nExperimento Creciente k=0.1") + 
  theme(plot.title = element_text(hjust = 0.5))
plot

Gráfico de Tiempos

Primer gráfico, excluyendo ABB para mejor apreciación de los datos

plot <- ggplot(data = Experimento_creciente0p1, aes(x=Operacion, y=V1), inherit.aes = FALSE) + 
  geom_line(aes(colour=Estructura)) +
  xlab("Promedios de cada segmento de iteraciones") +  
  ylab("Tiempo [s]") + 
  ggtitle("Tiempo por cada segmento de operaciones, sin ABB\nExperimento Creciente k=0.1") + 
  theme(plot.title = element_text(hjust = 0.5))
plot

Segundo gráfico, incluyendo ABB

z <- data.frame(Operacion = c(1:1000), V1 = creciente01.abb, Estructura = "ABB")
Experimento_creciente0p1 <- rbind(Experimento_creciente0p1, z)

plot <- ggplot(data = Experimento_creciente0p1, aes(x=Operacion, y=V1), inherit.aes = FALSE) + 
  geom_line(aes(colour=Estructura)) +
  xlab("Promedios de cada segmento de iteraciones") +  
  ylab("Tiempo [s]") + 
  ggtitle("Tiempo por cada segmento de operaciones\nExperimento Creciente k=0.1") + 
  theme(plot.title = element_text(hjust = 0.5))
plot

Experimento Creciente 0.5

creciente05.abb = read.table("Resultados/creciente0p5Abb.txt")
creciente05.avl = read.table("Resultados/creciente0p5Avl.txt")
creciente05.splay = read.table("Resultados/creciente0p5Splay.txt")
creciente05.btree16 = read.table("Resultados/creciente0p5Btree16.txt")
creciente05.btree256 = read.table("Resultados/creciente0p5Btree256.txt")
creciente05.btree4096 = read.table("Resultados/creciente0p5Btree4096.txt")
Experimento_creciente0p5 <-  data.frame(Operacion = integer(),
                                     V1 = double(),
                                     Estructura = factor()) 

z <- data.frame(Operacion = c(1:1000), V1 = creciente05.avl, Estructura = "AVL")
Experimento_creciente0p5 <- rbind(Experimento_creciente0p5, z)

z <- data.frame(Operacion = c(1:1000), V1 = creciente05.splay, Estructura = "Splay")
Experimento_creciente0p5 <- rbind(Experimento_creciente0p5, z)

z <- data.frame(Operacion = c(1:1000), V1 = creciente05.btree16, Estructura = "BTree16")
Experimento_creciente0p5 <- rbind(Experimento_creciente0p5, z)

z <- data.frame(Operacion = c(1:1000), V1 = creciente05.btree256, Estructura = "BTree256")
Experimento_creciente0p5 <- rbind(Experimento_creciente0p5, z)

z <- data.frame(Operacion = c(1:1000), V1 = creciente05.btree4096, Estructura = "BTree4096")
Experimento_creciente0p5 <- rbind(Experimento_creciente0p5, z)

Estadísticas relevantes

summary(Experimento_creciente0p5)
##    Operacion            V1             Estructura       
##  Min.   :   1.0   Min.   :0.0001280   Length:5000       
##  1st Qu.: 250.8   1st Qu.:0.0005580   Class :character  
##  Median : 500.5   Median :0.0007885   Mode  :character  
##  Mean   : 500.5   Mean   :0.0018489                     
##  3rd Qu.: 750.2   3rd Qu.:0.0019753                     
##  Max.   :1000.0   Max.   :0.0210580
plot <- ggplot(data = Experimento_creciente0p5, aes(x=Estructura, y=V1, color=Estructura)) + 
  geom_boxplot() +
  xlab("Estructuras") +  
  ylab("Tiempo [s]") + 
  ggtitle("Boxplot por cada estructura, sin ABB\nExperimento Creciente k=0.1") + 
  theme(plot.title = element_text(hjust = 0.5))
plot

Gráfico de Tiempos

plot <- ggplot(data = Experimento_creciente0p5, aes(x=Operacion, y=V1), inherit.aes = FALSE) + 
  geom_line(aes(colour=Estructura)) +
  xlab("Promedios de cada segmento de iteraciones") +  
  ylab("Tiempo [s]") + 
  ggtitle("Tiempo por cada segmento de operaciones, sin ABB\nExperimento Creciente k=0.5") + 
  theme(plot.title = element_text(hjust = 0.5))
plot

Segundo gráfico, incluyendo ABB

z <- data.frame(Operacion = c(1:1000), V1 = creciente01.abb, Estructura = "ABB")
Experimento_creciente0p1 <- rbind(Experimento_creciente0p1, z)

plot <- ggplot(data = Experimento_creciente0p1, aes(x=Operacion, y=V1), inherit.aes = FALSE) + 
  geom_line(aes(colour=Estructura)) +
  xlab("Promedios de cada segmento de iteraciones") +  
  ylab("Tiempo [s]") + 
  ggtitle("Tiempo por cada segmento de operaciones\nExperimento Creciente k=0.1") + 
  theme(plot.title = element_text(hjust = 0.5))
plot

Experimento Sesgado f(x)=x

sesgadox.abb = read.table("Resultados/sesgadoxAbb.txt")
sesgadox.avl = read.table("Resultados/sesgadoxAvl.txt")
sesgadox.splay = read.table("Resultados/sesgadoxSplay.txt")
sesgadox.btree16 = read.table("Resultados/sesgadoxBtree16.txt")
sesgadox.btree256 = read.table("Resultados/sesgadoxBtree256.txt")
sesgadox.btree4096 = read.table("Resultados/sesgadoxBtree4096.txt")
Experimento_sesgadox <-  data.frame(Operacion = integer(),
                                     V1 = double(),
                                     Estructura = factor()) 

z <- data.frame(Operacion = c(1:1000), V1 = sesgadox.abb, Estructura = "ABB")
Experimento_sesgadox <- rbind(Experimento_sesgadox, z)

z <- data.frame(Operacion = c(1:1000), V1 = sesgadox.avl, Estructura = "AVL")
Experimento_sesgadox <- rbind(Experimento_sesgadox, z)

z <- data.frame(Operacion = c(1:1000), V1 = sesgadox.splay, Estructura = "Splay")
Experimento_sesgadox <- rbind(Experimento_sesgadox, z)

z <- data.frame(Operacion = c(1:1000), V1 = sesgadox.btree16, Estructura = "BTree16")
Experimento_sesgadox <- rbind(Experimento_sesgadox, z)

z <- data.frame(Operacion = c(1:1000), V1 = sesgadox.btree256, Estructura = "BTree256")
Experimento_sesgadox <- rbind(Experimento_sesgadox, z)

Estadísticas relevantes

summary(Experimento_sesgadox)
##    Operacion            V1             Estructura       
##  Min.   :   1.0   Min.   :0.0001310   Length:5000       
##  1st Qu.: 250.8   1st Qu.:0.0005190   Class :character  
##  Median : 500.5   Median :0.0008260   Mode  :character  
##  Mean   : 500.5   Mean   :0.0009529                     
##  3rd Qu.: 750.2   3rd Qu.:0.0013823                     
##  Max.   :1000.0   Max.   :0.0048950
plot <- ggplot(data = Experimento_sesgadox, aes(x=Estructura, y=V1, color=Estructura)) + 
  geom_boxplot() +
  xlab("Estructuras") +  
  ylab("Tiempo [s]") + 
  ggtitle("Boxplot por cada estructura, sin BTree4096\nExperimento Sesgado f(x) = x") + 
  theme(plot.title = element_text(hjust = 0.5))
plot

Gráfico de Tiempos

Gráfico sin BTree4096

plot <- ggplot(data = Experimento_sesgadox, aes(x=Operacion, y=V1), inherit.aes = FALSE) + 
  geom_line(aes(colour=Estructura)) +
  xlab("Promedios de cada segmento de iteraciones") +  
  ylab("Tiempo [s]") + 
  ggtitle("Tiempo por cada segmento de operaciones, sin BTree4096\nExperimento Sesgado f(x) = x") + 
  theme(plot.title = element_text(hjust = 0.5))
plot

#### Gráfico con BTree4096

z <- data.frame(Operacion = c(1:1000), V1 = sesgadox.btree4096, Estructura = "BTree4096")
Experimento_sesgadox <- rbind(Experimento_sesgadox, z)

plot <- ggplot(data = Experimento_sesgadox, aes(x=Operacion, y=V1), inherit.aes = FALSE) + 
  geom_line(aes(colour=Estructura)) +
  xlab("Promedios de cada segmento de iteraciones") +  
  ylab("Tiempo [s]") + 
  ggtitle("Tiempo por cada segmento de operaciones, sin BTree4096\nExperimento Sesgado f(x) = x") + 
  theme(plot.title = element_text(hjust = 0.5))
plot

plot <- ggplot(data = Experimento_sesgadox, aes(x=Estructura, y=V1, color=Estructura)) + 
  geom_boxplot() +
  xlab("Estructuras") +  
  ylab("Tiempo [s]") + 
  ggtitle("Boxplot por cada estructura, sin BTree4096\nExperimento Sesgado f(x) = x") + 
  theme(plot.title = element_text(hjust = 0.5))
plot

Experimento Sesgado f(x)=sqrt(x)

sesgadosqrt.abb = read.table("Resultados/sesgadosqrtAbb.txt")
sesgadosqrt.avl = read.table("Resultados/sesgadosqrtAvl.txt")
sesgadosqrt.splay = read.table("Resultados/sesgadosqrtSplay.txt")
sesgadosqrt.btree16 = read.table("Resultados/sesgadosqrtBtree16.txt")
sesgadosqrt.btree256 = read.table("Resultados/sesgadosqrtBtree256.txt")
sesgadosqrt.btree4096 = read.table("Resultados/sesgadosqrtBtree4096.txt")
Experimento_sesgadosqrt <-  data.frame(Operacion = integer(),
                                     V1 = double(),
                                     Estructura = factor()) 

z <- data.frame(Operacion = c(1:1000), V1 = sesgadosqrt.abb, Estructura = "ABB")
Experimento_sesgadosqrt <- rbind(Experimento_sesgadosqrt, z)

z <- data.frame(Operacion = c(1:1000), V1 = sesgadosqrt.avl, Estructura = "AVL")
Experimento_sesgadosqrt <- rbind(Experimento_sesgadosqrt, z)

z <- data.frame(Operacion = c(1:1000), V1 = sesgadosqrt.splay, Estructura = "Splay")
Experimento_sesgadosqrt <- rbind(Experimento_sesgadosqrt, z)

z <- data.frame(Operacion = c(1:1000), V1 = sesgadosqrt.btree16, Estructura = "BTree16")
Experimento_sesgadosqrt <- rbind(Experimento_sesgadosqrt, z)

z <- data.frame(Operacion = c(1:1000), V1 = sesgadosqrt.btree256, Estructura = "BTree256")
Experimento_sesgadosqrt <- rbind(Experimento_sesgadosqrt, z)

Estadísticas relevantes

summary(Experimento_sesgadosqrt)
##    Operacion            V1             Estructura       
##  Min.   :   1.0   Min.   :0.0001450   Length:5000       
##  1st Qu.: 250.8   1st Qu.:0.0005257   Class :character  
##  Median : 500.5   Median :0.0008230   Mode  :character  
##  Mean   : 500.5   Mean   :0.0009784                     
##  3rd Qu.: 750.2   3rd Qu.:0.0014170                     
##  Max.   :1000.0   Max.   :0.0049380
plot <- ggplot(data = Experimento_sesgadosqrt, aes(x=Estructura, y=V1, color=Estructura)) + 
  geom_boxplot() +
  xlab("Estructuras") +  
  ylab("Tiempo [s]") + 
  ggtitle("Boxplot por cada estructura, sin BTree4096\nExperimento Sesgado f(x)=sqrt(x)") + 
  theme(plot.title = element_text(hjust = 0.5))
plot

Gráfico de Tiempos

Gráfico sin BTree4096

plot <- ggplot(data = Experimento_sesgadosqrt, aes(x=Operacion, y=V1), inherit.aes = FALSE) + 
  geom_line(aes(colour=Estructura)) +
  xlab("Promedios de cada segmento de iteraciones") +  
  ylab("Tiempo [s]") + 
  ggtitle("Tiempo por cada segmento de operaciones, sin BTree4096\nExperimento Sesgado f(x)=sqrt(x)") + 
  theme(plot.title = element_text(hjust = 0.5))
plot

#### Gráfico con BTree4096

z <- data.frame(Operacion = c(1:1000), V1 = sesgadosqrt.btree4096, Estructura = "BTree4096")
Experimento_sesgadosqrt <- rbind(Experimento_sesgadosqrt, z)

plot <- ggplot(data = Experimento_sesgadox, aes(x=Operacion, y=V1), inherit.aes = FALSE) + 
  geom_line(aes(colour=Estructura)) +
  xlab("Promedios de cada segmento de iteraciones") +  
  ylab("Tiempo [s]") + 
  ggtitle("Tiempo por cada segmento de operaciones\nExperimento Sesgado f(x) = sqrt(x)") + 
  theme(plot.title = element_text(hjust = 0.5))
plot

plot <- ggplot(data = Experimento_sesgadosqrt, aes(x=Estructura, y=V1, color=Estructura)) + 
  geom_boxplot() +
  xlab("Estructuras") +  
  ylab("Tiempo [s]") + 
  ggtitle("Boxplot por cada estructura, sin BTree4096\nExperimento Sesgado f(x)=sqrt(x)") + 
  theme(plot.title = element_text(hjust = 0.5))
plot

Experimento Sesgado f(x)=ln(x)

sesgadoln.abb = read.table("Resultados/sesgadolnAbb.txt")
sesgadoln.avl = read.table("Resultados/sesgadolnAvl.txt")
sesgadoln.splay = read.table("Resultados/sesgadolnSplay.txt")
sesgadoln.btree16 = read.table("Resultados/sesgadolnBtree16.txt")
sesgadoln.btree256 = read.table("Resultados/sesgadolnBtree256.txt")
sesgadoln.btree4096 = read.table("Resultados/sesgadolnBtree4096.txt")
Experimento_sesgadoln <-  data.frame(Operacion = integer(),
                                     V1 = double(),
                                     Estructura = factor()) 

z <- data.frame(Operacion = c(1:1000), V1 = sesgadoln.abb, Estructura = "ABB")
Experimento_sesgadoln <- rbind(Experimento_sesgadoln, z)

z <- data.frame(Operacion = c(1:1000), V1 = sesgadoln.avl, Estructura = "AVL")
Experimento_sesgadoln <- rbind(Experimento_sesgadoln, z)

z <- data.frame(Operacion = c(1:1000), V1 = sesgadoln.splay, Estructura = "Splay")
Experimento_sesgadoln <- rbind(Experimento_sesgadoln, z)

z <- data.frame(Operacion = c(1:1000), V1 = sesgadoln.btree16, Estructura = "BTree16")
Experimento_sesgadoln <- rbind(Experimento_sesgadoln, z)

z <- data.frame(Operacion = c(1:1000), V1 = sesgadoln.btree256, Estructura = "BTree256")
Experimento_sesgadoln <- rbind(Experimento_sesgadoln, z)

Estadísticas relevantes

summary(Experimento_sesgadoln)
##    Operacion            V1             Estructura       
##  Min.   :   1.0   Min.   :0.0001610   Length:5000       
##  1st Qu.: 250.8   1st Qu.:0.0005368   Class :character  
##  Median : 500.5   Median :0.0008460   Mode  :character  
##  Mean   : 500.5   Mean   :0.0009671                     
##  3rd Qu.: 750.2   3rd Qu.:0.0014170                     
##  Max.   :1000.0   Max.   :0.0053300
plot <- ggplot(data = Experimento_sesgadoln, aes(x=Estructura, y=V1, color=Estructura)) + 
  geom_boxplot() +
  xlab("Estructuras") +  
  ylab("Tiempo [s]") + 
  ggtitle("Boxplot por cada estructura\nExperimento Sesgado f(x)=ln(x)") + 
  theme(plot.title = element_text(hjust = 0.5))
plot

Gráfico de Tiempos

Gráfico sin BTree4096

plot <- ggplot(data = Experimento_sesgadoln, aes(x=Operacion, y=V1), inherit.aes = FALSE) + 
  geom_line(aes(colour=Estructura)) +
  xlab("Promedios de cada segmento de iteraciones") +  
  ylab("Tiempo [s]") + 
  ggtitle("Tiempo por cada segmento de operaciones\nExperimento Sesgado f(x)=ln(x)") + 
  theme(plot.title = element_text(hjust = 0.5))
plot

Gráfico sin BTree4096

z <- data.frame(Operacion = c(1:1000), V1 = sesgadoln.btree4096, Estructura = "BTree4096")
Experimento_sesgadoln <- rbind(Experimento_sesgadoln, z)

plot <- ggplot(data = Experimento_sesgadoln, aes(x=Operacion, y=V1), inherit.aes = FALSE) + 
  geom_line(aes(colour=Estructura)) +
  xlab("Promedios de cada segmento de iteraciones") +  
  ylab("Tiempo [s]") + 
  ggtitle("Tiempo por cada segmento de operaciones\nExperimento Sesgado f(x)=ln(x)") + 
  theme(plot.title = element_text(hjust = 0.5))
plot

plot <- ggplot(data = Experimento_sesgadoln, aes(x=Estructura, y=V1, color=Estructura)) + 
  geom_boxplot() +
  xlab("Estructuras") +  
  ylab("Tiempo [s]") + 
  ggtitle("Boxplot por cada estructura\nExperimento Sesgado f(x)=ln(x)") + 
  theme(plot.title = element_text(hjust = 0.5))
plot


 

A work by cd